import request from '@/utils/request'

// 查询采购员信息列表
export function listPurchase(query) {
  return request({
    url: '/manage/purchaseList',
    method: 'get',
    params: query
  })
}

// 查询采购员信息详细
export function getPurchase(purchaseId) {
  return request({
    url: '/system/purchase/' + purchaseId,
    method: 'get'
  })
}

// 新增采购员信息
export function addPurchase(data) {
  return request({
    url: '/purchase',
    method: 'post',
    data: data
  })
}

// 修改采购员信息
export function updatePurchase(data) {
  return request({
    url: '/purchase',
    method: 'put',
    data: data
  })
}

// 删除采购员信息
export function delPurchase(purchaseId) {
  return request({
    url: '/manage/delete/purchases/?ids=' + purchaseId,
    method: 'delete'
  })
}

// 查询物资列表
export function listMaterial(query) {
  return request({
    url: '/material/list',
    method: 'post',
    params: query
  })
}

// 查询子类别列表
export function listMaterialType(query) {
  return request({
    url: '/type/list',
    method: 'post',
    params: query
  })
}

// 新增物资信息
export function addMaterial(data) {
  return request({
    url: '/material',
    method: 'post',
    params: data
  })
}

// 新增公司类别
export function addType(data) {
  return request({
    url: '/type',
    method: 'post',
    params: data
  })
}
// 删除公司类别
export function delType(id) {
  return request({
    url: `/type?id=` + id,
    method: 'delete'
  })
}
// 修改物资信息
export function updateMaterial(data) {
  return request({
    url: '/material',
    method: 'put',
    params: data
  })
}

// 删除物资信息
export function delMaterial(id) {
  return request({
    url: `/material?id=` + id,
    method: 'delete'
  })
}
// 查询物品最低价格
export function getLowPrice(query) {
  return request({
    url: '/order/comparison',
    method: 'get',
    params: query
  })
}

// 查询子类公司种类
export function listType(data) {
  return request({
    url: '/type/list',
    method: 'post',
    params: data
  })
}
// 查预订单价格
export function lowestPrice(data) {
  return request({
    url: '/order/up/lowestprice',
    method: 'post',
    data: data
  })
}